import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Home',
    redirect: '/Index',
    component: () => import('@/views/blog/Home'),
    children: [
      {
        path: '/Index',
        name: 'Index',
        component: () => import('@/views/blog/Index'),
      },
      {
        path: '/Book',
        name: 'Book',
        component: () => import('@/views/blog/Book'),
      },
      {
        path: '/Info/:id',
        name: 'Info',
        component: () => import('@/views/blog/Info'),
      },
      {
        path: '/TimeLine',
        name: 'TimeLine',
        component: () => import('@/views/blog/TimeLine'),
      }
    ]
  },
  {
    path: '/Sys/Index',
    name: 'Sys/Index',
    redirect: '/Sys/We',
    component: () => import('@/views/sys/Index'),
    children: [
      {
        path: '/Sys/We',
        name: 'Sys/We',
        component: () => import('@/views/sys/We'),
      },
      {
        path: '/Sys/BookEditList',
        name: 'Sys/BookEditList',
        component: () => import('@/views/sys/BookEditList'),
      }
    ]
  },
  {
    path: '/Login',
    name: 'Login',
    component: () => import('@/views/sys/Login')
  },
  {
    path: '*',
    name: '*',
    component: () => import('@/views/error/404')
  },
  {
    path: '/e403',
    name: 'e403',
    component: () => import('@/views/error/403')
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
